package cn.com.headfree.mouldshow.dao.impl;

import cn.com.headfree.entity.TEducateInfoTemp;
import cn.com.headfree.mouldshow.dao.TEducateInfoTempDao;
import com.gta.edu.sdk.base.dao.impl.BaseDaoImpl;
import org.springframework.stereotype.Repository;

import java.sql.Timestamp;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Repository("/tEducateInfoTempDao")
public class TEducateInfoTempDaoImpl extends BaseDaoImpl<TEducateInfoTemp> implements TEducateInfoTempDao {


    @Override
    public void saveInfo(TEducateInfoTemp tEducateInfo) {
        String sql = "insert into t_educate_info_temp (id,user_name,acqu_time,start_time,end_time,grad_school,school_type,major,educ_name,degree_name,is_cont_educ,is_employ_educ,is_highest_educ,erp_no,id_card_no,org_id,creater_id,creater_name,create_time,updater_id,updater_name,update_time,del_sign,is_valid,audit_state,orignal_id,business_type_id,primitive_id) values ";
        StringBuilder sqlBuilder = new StringBuilder(sql);
        sqlBuilder.append("(#{id,jdbcType=VARCHAR},").append("#{user_name,jdbcType=VARCHAR},").append("#{acqu_time,jdbcType=DATE},")
                .append("#{start_time,jdbcType=DATE},").append("#{end_time,jdbcType=DATE},")
                .append("#{grad_school,jdbcType=VARCHAR},").append("#{school_type,jdbcType=VARCHAR},")
                .append("#{major,jdbcType=VARCHAR},").append("#{educ_name,jdbcType=VARCHAR},")
                .append("#{degree_name,jdbcType=VARCHAR},").append("#{is_cont_educ,jdbcType=VARCHAR},")
                .append("#{is_employ_educ,jdbcType=VARCHAR},").append("#{is_highest_educ,jdbcType=VARCHAR},")
                .append("#{erp_no,jdbcType=VARCHAR},").append("#{id_card_no,jdbcType=VARCHAR},")
                .append("#{org_id,jdbcType=VARCHAR},").append("#{creater_id,jdbcType=VARCHAR},")
                .append("#{creater_name,jdbcType=VARCHAR},").append("#{create_time,jdbcType=DATE},")
                .append("#{updater_id,jdbcType=VARCHAR},").append("#{updater_name,jdbcType=VARCHAR},")
                .append("#{update_time,jdbcType=DATE},").append("#{del_sign,jdbcType=INTEGER},")
                .append("#{is_valid,jdbcType=INTEGER},").append("#{audit_state,jdbcType=INTEGER},")
                .append("#{orignal_id,jdbcType=VARCHAR},").append("#{business_type_id,jdbcType=VARCHAR},")
                .append("#{primitive_id,jdbcType=VARCHAR})");
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("id", tEducateInfo.getId());
        params.put("user_name", tEducateInfo.getUserName());
        params.put("acqu_time", tEducateInfo.getAcquTime());
        params.put("start_time", tEducateInfo.getStartTime());
        params.put("end_time", tEducateInfo.getEndTime());
        params.put("grad_school", tEducateInfo.getGradSchool());
        params.put("school_type", tEducateInfo.getSchoolType());
        params.put("major", tEducateInfo.getMajor());
        params.put("educ_name", tEducateInfo.getEducName());
        params.put("degree_name", tEducateInfo.getDegreeName());
        params.put("is_cont_educ", tEducateInfo.getIsContEduc());
        params.put("is_employ_educ", tEducateInfo.getIsEmployEduc());
        params.put("is_highest_educ", tEducateInfo.getIsHighestEduc());
        params.put("erp_no", tEducateInfo.getErpNo());
        params.put("id_card_no", tEducateInfo.getIdCardNo());
        params.put("org_id", tEducateInfo.getOrgId());
        params.put("creater_id", tEducateInfo.getCreaterId());
        params.put("creater_name", tEducateInfo.getCreaterName());
        params.put("create_time", new Timestamp(new Date().getTime()));
        params.put("updater_id", tEducateInfo.getUpdaterId());
        params.put("updater_name", tEducateInfo.getUpdaterName());
        params.put("update_time", new Timestamp(new Date().getTime()));
        params.put("del_sign", 0);
        params.put("is_valid", tEducateInfo.getIsValid());
        params.put("audit_state", tEducateInfo.getAuditState());
        params.put("orignal_id", tEducateInfo.getOrignalId());
        params.put("business_type_id", tEducateInfo.getBusinessTypeId());
        params.put("primitive_id", tEducateInfo.getPrimitiveId());
        this.executeSql(sqlBuilder.toString(), params);
    }
}
